function [foundcells, cellra] = getra(animal, date, region, neuron)
fprintf(1,'.')
cells = rawxlscells(animal);
if isempty(cells)
    cellra = [];
    foundcells = [];
    return
end

if length(date) > 0
    datefound = ismember(cells(:,2), date);
else
    datefound = true(size(cells,1),1);
end

if length(region) > 0
    regionfound = ismember(cells(:,3), region);
else
    regionfound = true(size(cells,1),1);
end

if neuron ~= 0
    neuronfound = ([cells{:,4}]== neuron)';
else
    neuronfound = true(size(cells,1),1);
end
found = find(neuronfound & regionfound & datefound);
foundcells = cells(found,1:6);
if isempty(found)
    cellra = [];
    foundcells = [];
    disp('getra.m: No matching data found.')
    animal
    date
    region
    neuron
else
    
    stimactsizes = NaN(length(found),4);
    for i = 1:length(found)
        ExpID = cells{found(i),5};
        roiID = cells{found(i),6};
        stimactivity  = getcellstimactivity(ExpID,roiID);
        if ~(isempty(stimactivity));
            stimactsizes(i,:) = size(stimactivity);
        else
            animal
            date
            region
            neuron
            
            disp('Have an espresso, review your data and then ask me again...')
            cellra = [];
            foundcells = [];
            return
        end
        
    end
    if size(stimactsizes,1) > 1
        if  ~isempty(find(diff(stimactsizes(:,1))~=0)) || ~isempty(find(diff(stimactsizes(:,2))~=0)) || ~isempty(find(diff(stimactsizes(:,3))~=0)) || ~isempty(find(diff(stimactsizes(:,4))~=0))
            fprintf(2,'The sizes of the results (eyes orientations reititions activity_datapoints) do not match! I''m using the biggest match.')
            disp(' ')
            animal
            date
            region
            neuron
            
            stimactsizes
        end
    end
    cellra = NaN(max(stimactsizes(:,1)),max(stimactsizes(:,2)),max(stimactsizes(:,3)),length(found));
    
    
    for i = 1:length(found)
        ExpID = cells{found(i),5};
        roiID = cells{found(i),6};
        idxbasestart = cells{found(i),7};
        idxbasestop = cells{found(i),8};
        idxstimstart = cells{found(i),9};
        idxstimstop = cells{found(i),10};
        stimactivity  = getcellstimactivity(ExpID,roiID);
        if ~(isempty(stimactivity));
            for ieye = 1:size(stimactivity,1)
                for iori = 1:size(stimactivity,2)
                    for irep = 1:size(stimactivity,3)
                        cellra(ieye,iori,irep,i) = respamp(stimactivity(ieye,iori,irep,:), idxbasestart, idxbasestop, idxstimstart, idxstimstop);
                    end
                end
            end
        else
            disp('Have an espresso, review your data and then ask me again...')
            cellra = [];
            foundcells = [];
        end
        
    end
end
%ramean1 = ramean(cellra)
%[ra,orimax]=max(ramean1,[],2)
%ramax1 = ramax(cellra)
%od(ramean(cellra))
%od(ramax(cellra))

